<?php

class backendConfiguration extends sfApplicationConfiguration {

    protected $frontendRouting = null;

    public function generateFrontendUrl($name, $parameters = array()) {
        $env = (sfConfig::get('sf_environment') === "prod") ? 'index.php' : 'frontend_dev.php';
        return public_path ('/') . $env . $this->getFrontendRouting()->generate($name, $parameters);
    }

    public function getFrontendRouting() {
        if (!$this->frontendRouting) {
            $this->frontendRouting = new sfPatternRouting(new sfEventDispatcher());

            $config = new sfRoutingConfigHandler();
            $routes = $config->evaluate(array(sfConfig::get('sf_apps_dir') . '/frontend/config/routing.yml'));

            $this->frontendRouting->setRoutes($routes);
        }

        return $this->frontendRouting;
    }
    
    public function configure() {
        /* ... */
    }
}
